<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="./js/ajax.js"></script>
    <script>
        //使用封装后的promise
        // let p1= pAjax({url:'http://localhost:8888/test/first'})
        // console.log(p1);//得到的是promise对象
        // p1.then((data)=>{
        //     console.log(data);
        // })
        //使用async和await
        async function fn(){
            let res1=await pAjax({url:'http://localhost:8888/test/first'})
            console.log(res1);
        }
        fn()
    </script>
</body>
</html>